package com.fang.modbus.struct.pdu;

import com.fang.modbus.struct.ModbusFuncCode;
import com.fang.modbus.util.ModbusTypeConverter;

public class WriteSingleRegisterUnit extends ModbusProtoUnitSupport
{
    public WriteSingleRegisterUnit()
    {
        super(ModbusFuncCode.WRITE_SINGLE_REGISTER);
    }

    public WriteSingleRegisterUnit(int address, int value) 
    {
        super(ModbusFuncCode.WRITE_SINGLE_REGISTER, address, value);
    }

    public int getAddress() {
        return startAddr;
    }

    public int getValue() {
        return quantity;
    }
    
    @Override
    public String toString()
    {
		return this.getClass().getSimpleName() + "{funcCode=" + ModbusTypeConverter.toHexStr(funcCode) + ", address="
				+ ModbusTypeConverter.toHexStr(startAddr) + ", value=" + ModbusTypeConverter.toHexStr(quantity) + '}';
    }
}
